﻿

Public Class TiecCuoi_BLL
    'Them tiec cuoi
    Public Sub Them(ByVal tc As TiecCuoi)
        Dim db As New QLTCDataContext()
        db.TiecCuois.InsertOnSubmit(tc)
        db.SubmitChanges()

    End Sub

    'Public Function LayDanhSach() As IList
    '    Dim db As New QLTCDataContext()
    '    Dim query = From tieccuoi In db.TiecCuois
    '                Select tieccuoi
    '    Return query.ToList()
    'End Function

    Public Function LayMa() As Integer
        Dim db As New QLTCDataContext()
        Dim query = (From matieccuoi In db.TiecCuois Select (matieccuoi.ID)).Max()
        Return query.ToString()
    End Function

    Public Function LaySanh(ByVal ngay As DateTime, ByVal ca As String) As IList
        'lay ra tat ca cac sanh
        Dim sanhbus As New Sanh_BLL()
        Dim dssanh As IList = sanhbus.LayDanhSach()

        'lay ra cac sanh da duoc dat trong ngay do va trong ca do
        'Dim db As New QLTCDataContext
        'Dim sanhduocdat = From tieccuoi In db.TiecCuois
        '           Where tieccuoi.Ngay = ngay And tieccuoi.Ca = ca
        '           Select tieccuoi.Sanh

        'Dim query = From ds In dssanh
        '        From sddat In sanhduocdat
        '        Where ds.id <> sddat
        '        Select ds
        'Return query.ToList()

        Return dssanh

    End Function
End Class
